//
//  LoginView.m
//  liBaQiang
//
//  Created by 奇林刘 on 2018/10/19.
//  Copyright © 2018年 liu. All rights reserved.
//

#import "LoginView.h"

@interface LoginView ()

@property (nonatomic, strong) UIImageView *logo;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIView *accountBottomLine;
@property (nonatomic, strong) UIView *passwordBottomLine;
@property (nonatomic, strong) UIView *verifyBottomLine;
@property (nonatomic, strong) UIView *portraitLine;


@end

@implementation LoginView

- (void)configSelf {
    self.fp_backgroundColor(HexadecimalColor(@"#FFFFFF"));
}

- (void)allocateComponents {
    self.fp_addSubview(self.logo=[[UIImageView alloc]init]);
    [self.logo mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self);
        make.height.equalTo(@(RPX(260)));
    }];
    
    self.fp_addSubview(self.titleLabel=[[UILabel alloc]init]);
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.logo);
    }];
    
    self.fp_addSubview(self.accountField=[[UITextField alloc]init]);
    [self.accountField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.logo.mas_bottom).offset(RPX(32));
        make.width.equalTo(@(RPX(333)));
    }];
    
    self.fp_addSubview(self.accountBottomLine=[[UIView alloc]init]);
    [self.accountBottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@(1));
        make.width.equalTo(@(RPX(345)));
        make.top.equalTo(self.logo.mas_bottom).offset(RPX(67));
        make.centerX.equalTo(self);
    }];
    
    self.fp_addSubview(self.passwordField=[[UITextField alloc]init]);
    [self.passwordField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.accountBottomLine.mas_bottom).offset(RPX(22));
        make.width.equalTo(@(RPX(333)));
    }];
    
    self.fp_addSubview(self.passwordBottomLine=[[UIView alloc]init]);
    [self.passwordBottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@(1));
        make.width.equalTo(@(RPX(345)));
        make.top.equalTo(self.logo.mas_bottom).offset(RPX(124));
        make.centerX.equalTo(self);
    }];
    
    self.fp_addSubview(self.verifyField = [[UITextField alloc] init]);
    [self.verifyField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.passwordBottomLine.mas_bottom).offset(RPX(22));
        make.width.equalTo(@(RPX(333)));
    }];
    
    self.fp_addSubview(self.verifyBottomLine = [[UIView alloc] init]);
    [self.verifyBottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@(1));
        make.width.equalTo(@(RPX(345)));
        make.top.equalTo(self.logo.mas_bottom).offset(RPX(181));
        make.centerX.equalTo(self);
    }];
    
    self.fp_addSubview(self.requestVerifyButton = [[UIButton alloc] init]);
    [self.requestVerifyButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.verifyField);
        make.right.equalTo(self).offset(RPX(-21));
    }];
    
    self.fp_addSubview(self.loginButton=[[UIButton alloc]init]);
    [self.loginButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.width.equalTo(@(RPX(345)));
        make.height.equalTo(@(RPX(44)));
        make.top.equalTo(self.verifyBottomLine.mas_bottom).offset(RPX(25));
    }];
    
    self.fp_addSubview(self.portraitLine=[[UIView alloc]init]);
    [self.portraitLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(@(1));
        make.height.equalTo(@(RPX(20)));
        make.centerX.equalTo(self);
        make.bottom.equalTo(self).offset(RPX(-20));
    }];
    
    self.fp_addSubview(self.forgetButton=[[UIButton alloc]init]);
    [self.forgetButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.portraitLine);
        make.right.equalTo(self.portraitLine.mas_left).offset(RPX(-21));
    }];
    
    self.fp_addSubview(self.registerButton=[[UIButton alloc]init]);
    [self.registerButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.portraitLine);
        make.left.equalTo(self.portraitLine.mas_right).offset(RPX(21));
    }];
}

- (void)configComponents {
    [self.logo setImage:[UIImage imageNamed:@"login_banner"]];
    self.titleLabel.fp_text(@"P A S E N").fp_font(RPXFont(23)).fp_textColor(HexadecimalColor(@"#FFFFFF"));
    self.accountField.placeholder = @"手机号";
    self.accountField.keyboardType = UIKeyboardTypeNumberPad;
    self.accountField.font = RPXFont(14);
    self.accountBottomLine.fp_backgroundColor(HexadecimalColor(@"#EBEBEB"));
    self.passwordField.placeholder = @"密码";
    self.passwordField.font = RPXFont(14);
    self.passwordBottomLine.fp_backgroundColor(HexadecimalColor(@"#EBEBEB"));
    self.verifyField.placeholder = @"验证码";
    self.verifyField.font = RPXFont(14);
    self.verifyBottomLine.fp_backgroundColor(HexadecimalColor(@"#EBEBEB"));
    self.loginButton
        .fp_backgroundColor(HexadecimalColor(@"#2D5898"))
        .fp_cornerRadius(RPX(4));
    [self.requestVerifyButton setTitle:@"发送验证码" forState:UIControlStateNormal];
    [self.requestVerifyButton setTitleColor:HexadecimalColor(@"#275FB2") forState:UIControlStateNormal];
    [self.requestVerifyButton.titleLabel setFont:RPXFont(14)];
    [self.loginButton setTitle:@"登录" forState:UIControlStateNormal];
    self.loginButton.titleLabel.fp_font(RPXFont(16));
    self.portraitLine.fp_backgroundColor(HexadecimalColor(@"#CCCCCC"));
    [self.forgetButton setTitle:@"忘记密码" forState:UIControlStateNormal];
    [self.forgetButton setTitleColor:HexadecimalColor(@"#999999") forState:UIControlStateNormal];
    self.forgetButton.titleLabel.fp_font(RPXFont(14));
    [self.registerButton setTitle:@"注册账号" forState:UIControlStateNormal];
    [self.registerButton setTitleColor:HexadecimalColor(@"#999999") forState:UIControlStateNormal];
    self.registerButton.titleLabel.fp_font(RPXFont(14));
}


@end
